package com.gp.controller;

import com.gp.service.CarConfigService;
import com.gp.entity.TbCarTypeConfigDetails;
import com.gp.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("rent/carConfig")
public class CarConfigController {

    @Autowired
    CarConfigService carConfigService;


    @PostMapping("findAll")
    public CommonResult findAll(Integer page,Integer limit, String nametype){
        return carConfigService.findAllConfig(page, limit, nametype);
    }
    @DeleteMapping("delCarById")
    private CommonResult eleteByIdd(Integer id){
        return carConfigService.deleteById(id);
    }

    @PostMapping("insert")
    private CommonResult insert(@RequestBody TbCarTypeConfigDetails tbCarTypeConfigDetails){
        return carConfigService.insertCarConfig(tbCarTypeConfigDetails);
    }

    @PutMapping("updateConfig")
    private CommonResult updateCartype(@RequestBody TbCarTypeConfigDetails tbCarTypeConfigDetails ){
        return carConfigService.upateCarConfig(tbCarTypeConfigDetails);
    }

}
